Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jolor

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jolor

JavaScript color converter

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Jolor

JavaScript color converter to HEX, RGB, RGBA, HSL

Install

npm install jolor

IsColor

Checks if a string is HTML colors value

import { isColor } from 'jolor';

isColor('white');
isColor('#888');
isColor('#f1f1f1');
isColor('rgb(0,100,255)');
isColor('hsl(100,50%,80%)');
//=> true

Color converting

import { toHex, toRgb, toRgba, toHsl } from 'jolor';

toHex('deepskyblue');
toHex(0, 191, 255);
toHex([0, 191, 255]);
toHex('rgb(0,191,255)');
toHex('hsl(195,100%,50%)');
//=> '#00bfff'

#00bfff

toRgb('indigo');
toRgb(75, 0, 130);
toRgb([75, 0, 130]);
toRgb('#4b0082');
//=> 'rgb(75,0,130)'

toRgb('hsl(275, 100%, 25%)');
//=> 'rgb(74, 0, 128)'

#4b0082

toRgba('sandybrown');
toRgba('rgb(244,164,96)');
toRgba('#f4a460');
//=> 'rgba(244,164,96,1)'

toRgba([244, 164, 96, 0.1]);
toRgba(244, 164, 96, 0.1);
//=> 'rgba(244,164,96,0.1)'

toRgba('hsl(28, 87%, 67%)');
//=> 'rgba(244,166,98,1)'

#f4a460

toHsl('purple');
toHsl([128, 0, 128]);
toHsl(128, 0, 128);
toHsl('rgb(128,0,128)');
toHsl('#800080');
//=> 'hsl(300,100%,25%)'

#800080

Keywords

FAQs

Package last updated on 30 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc